import time
from month_99.Base.Base import Base
from selenium.webdriver.common.by import By

class Page1(Base):
    login_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')
    def login(self):
        self.click(self.login_loc)

    username_loc = (By.NAME,'username')
    def username(self):
        self.send_keys(self.username_loc,'15235688537')

    password_loc = (By.NAME,'password')
    def password(self):
        self.send_keys(self.password_loc,'a123123')

    loginbtn_loc = (By.XPATH,'//*[@id="theForm"]/div[5]/a')
    def loginbtn(self):
        self.click(self.login_loc)

    def A3mall_01(self):
        try:
            self.open_url('http://10.59.9.12:7001/')
            self.login()
            time.sleep(3)
            self.username()
            time.sleep(1)
            self.password()
            time.sleep(15)
            self.loginbtn()
        except Exception as e:
            t = time.strftime('%Y%m%d%H%M%S', time.localtime())
            self.driver.save_screenshot(t + '.png')
            print(e)
